<?php
//连接数据库
$con = mysqli_connect("localhost","root","","friday");
mysqli_set_charset($con,"utf8");
$sql = "select * from goods";
$result = mysqli_query($con, $sql);
$arr = mysqli_fetch_all($result,MYSQLI_ASSOC);
echo json_encode($arr);
//关闭数据库
mysqli_close($con);

?>